// product/product-info?id={id}
import Taro from '@tarojs/taro'
import { IProductInfoResponse } from '../inteface/product-info'
import { IResponse } from './base'

export const getProductInfo = async (id: string) => {
  try {
    const {
      data: { data },
    } = await Taro.cloud.callContainer<IResponse<IProductInfoResponse>>({
      path: `/api/product/product-info?id=${id}`,
      header: {
        'X-WX-SERVICE': 'dshx-back-end',
      },
    })
    return data
  } catch (error) {
    Taro.showToast({
      title: error.message,
      icon: 'none',
    })
  }
}
